unit SkypeControlConst;

interface

uses classes;

const ATTACH_SUCCESS               = 0;
      ATTACH_PENDING_AUTHORIZATION = 1;
      ATTACH_REFUSED               = 2;
      ATTACH_NOT_AVAILABLE         = 3;
      ATTACH_API_AVAILABLE         = $8001;

      SUPPORTED_PROTOCOL = 4;

//------------------------------------------------------------------------------
// User Status -----------------------------------------------------------------

type TSkypeUserStatus = (usUnknown, usOnline, usOffline, usAway, usNA, usDND,
                         usInvisible, usLoggedOut, usSkypeMe);

const USERSTATUS_STR : array[usUnknown..usSkypeMe] of string =
                        ('UNKNOWN','ONLINE','OFFLINE','AWAY','NA','DND',
                         'INVISIBLE','LOGGEDOUT','SKYPEME');

const READABLE_USERSTATUS : array[1..SUPPORTED_PROTOCOL] of
                              set of TSkypeUserStatus =
                        // Protocol 1
                       ([usUnknown, usOnline, usOffline, usAway, usNA, usDND,
                        usInvisible, usLoggedOut],
                        // Protocol 2
                        [usUnknown, usOnline, usOffline, usAway, usNA, usDND,
                        usInvisible, usLoggedOut, usSkypeMe],
                        // Protocol 3
                        [usUnknown, usOnline, usOffline, usAway, usNA, usDND,
                        usInvisible, usLoggedOut, usSkypeMe],
                        // Protocol 4
                        [usUnknown, usOnline, usOffline, usAway, usNA, usDND,
                        usInvisible, usLoggedOut, usSkypeMe]);

const WRITEABLE_USERSTATUS : array[1..SUPPORTED_PROTOCOL] of
                               set of TSkypeUserStatus =
                        // Protocol 1
                       ([usOnline, usOffline, usAway, usNA, usDND, usInvisible],
                        // Protocol 2
                        [usOnline, usOffline, usAway, usNA, usDND, usInvisible,
                         usSkypeMe],
                        // Protocol 3
                        [usOnline, usOffline, usAway, usNA, usDND, usInvisible,
                         usSkypeMe],
                        // Protocol 4
                        [usOnline, usOffline, usAway, usNA, usDND, usInvisible,
                         usSkypeMe]);

//------------------------------------------------------------------------------
// Connection Status -----------------------------------------------------------

type TSkypeConnStatus = (csOffline, csConnecting, csPausing, csOnline,
                         csLoggedOut);

const CONNSTATUS_STR : array[csOffline..csLoggedOut] of string =
                        ('OFFLINE','CONNECTING','PAUSING','ONLINE','LOGGEDOUT');

const READABLE_CONNSTATUS : array[1..SUPPORTED_PROTOCOL] of
                              set of TSkypeConnStatus =
                         // Protocol 1
                        ([csOffline, csConnecting, csPausing, csOnline,
                          csLoggedOut],
                         // Protocol 2
                         [csOffline, csConnecting, csPausing, csOnline,
                          csLoggedOut],
                         // Protocol 3
                         [csOffline, csConnecting, csPausing, csOnline,
                          csLoggedOut],
                         // Protocol 4
                         [csOffline, csConnecting, csPausing, csOnline,
                          csLoggedOut]);

const WRITEABLE_CONNSTATUS : array[1..SUPPORTED_PROTOCOL] of
                               set of TSkypeConnStatus =
                         // Protocol 1
                        ([],
                         // Protocol 2
                         [],
                         // Protocol 3
                         [],
                         // Protocol 4
                         []);

//------------------------------------------------------------------------------
// Searchtypes -----------------------------------------------------------------

type TSkypeSearchType = (stUsers, stFriends, stCalls, stActiveCalls,
                         stMissedCalls, stMessages, stMissedMessages, stChats,
                         stActiveChats, stMissedChats, stRecentChats,
                         stBookmarkedChats, stChatMsgs, stMissedChatMsgs);

const SEARCHTYPE_STR : array[stUsers..stMissedChatMsgs] of string =
                        ('USERS','FRIENDS','CALLS','ACTIVECALLS','MISSEDCALLS',
                         'MESSAGES','MISSEDMESSAGES','CHATS','ACTIVECHATS',
                         'MISSEDCHATS','RECENTCHATS','BOOKMARKEDCHATS',
                         'CHATMESSAGES','MISSEDCHATMESSAGES');

const SEARCHABLE_TYPE : array[1..SUPPORTED_PROTOCOL] of
                          set of TSkypeSearchType =
                        // Protocol 1
                       ([stUsers, stFriends, stCalls, stActiveCalls,
                         stMissedCalls, stMessages, stMissedMessages],
                        // Protocol 2
                        [stUsers, stFriends, stCalls, stActiveCalls,
                         stMissedCalls, stMessages, stMissedMessages],
                        // Protocol 3
                        [stUsers, stFriends, stCalls, stActiveCalls,
                         stMissedCalls, stMissedMessages, stChats, stChatMsgs,
                         stMissedChatMsgs],  // i did NOT forget stMessages ;-)
                                             // it just don't work with Skype
                                             // at the moment (Skype 1.2 Beta)
                        // Protocol 4
                        [stUsers, stFriends, stCalls, stActiveCalls,
                         stMissedCalls, stMissedMessages, stChats,
                         stActiveChats, stMissedChats, stRecentChats,
                         stBookmarkedChats, stChatMsgs,
                         stMissedChatMsgs]); // stMessages, stActiveChats,
                                             // stMissedChats, stRecentChats,
                                             // stBookmarkedChats don't work
                                             // at the moment (Skype 1.2 Beta)
//------------------------------------------------------------------------------
// User Properties -------------------------------------------------------------

type TSkypeUserProperty = (upHandle, upFullname, upBirthday, upSex, upLanguage,
                           upCountry, upProvince, upCity, upPhoneHome,
                           upPhoneOffice, upPhoneMobile, upHomepage, upAbout,
                           upHasCallEquipment, upBuddyStatus, upIsAuthorized,
                           upIsBlocked, upDisplayname, upOnlineStatus,
                           upLastOnlineTimeStamp);

const USERPROPERTY_STR : array[upHandle..upLastOnlineTimeStamp] of string =
                          ('HANDLE','FULLNAME','BIRTHDAY','SEX','LANGUAGE',
                           'COUNTRY','PROVINCE','CITY','PHONE_HOME',
                           'PHONE_OFFICE','PHONE_MOBILE','HOMEPAGE','ABOUT',
                           'HASCALLEQUIPMENT','BUDDYSTATUS','ISAUTHORIZED',
                           'ISBLOCKED','DISPLAYNAME','ONLINESTATUS',
                           'LASTONLINETIMESTAMP');

const READABLE_USERPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                set of TSkypeUserProperty =
                           // Protocol 1
                          ([upHandle, upFullname, upBirthday, upSex, upLanguage,
                            upCountry, upProvince, upCity, upPhoneHome,
                            upPhoneOffice, upPhoneMobile, upHomepage, upAbout,
                            upHasCallEquipment, upBuddyStatus, upIsAuthorized,
                            upIsBlocked, upDisplayname, upOnlineStatus,
                            upLastOnlineTimeStamp],
                           // Protocol 2
                           [upHandle, upFullname, upBirthday, upSex, upLanguage,
                            upCountry, upProvince, upCity, upPhoneHome,
                            upPhoneOffice, upPhoneMobile, upHomepage, upAbout,
                            upHasCallEquipment, upBuddyStatus, upIsAuthorized,
                            upIsBlocked, upDisplayname, upOnlineStatus,
                            upLastOnlineTimeStamp],
                           // Protocol 3
                           [upHandle, upFullname, upBirthday, upSex, upLanguage,
                            upCountry, upProvince, upCity, upPhoneHome,
                            upPhoneOffice, upPhoneMobile, upHomepage, upAbout,
                            upHasCallEquipment, upBuddyStatus, upIsAuthorized,
                            upIsBlocked, upDisplayname, upOnlineStatus,
                            upLastOnlineTimeStamp],
                           // Protocol 4
                           [upHandle, upFullname, upBirthday, upSex, upLanguage,
                            upCountry, upProvince, upCity, upPhoneHome,
                            upPhoneOffice, upPhoneMobile, upHomepage, upAbout,
                            upHasCallEquipment, upBuddyStatus, upIsAuthorized,
                            upIsBlocked, upDisplayname, upOnlineStatus,
                            upLastOnlineTimeStamp]);

const WRITEABLE_USERPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                 set of TSkypeUserProperty =
                           // Protocol 1
                          ([],
                           // Protocol 2
                           [],
                           // Protocol 3
                           [],
                           // Protocol 4
                           []);

//------------------------------------------------------------------------------
// Call Properties -------------------------------------------------------------

type TSkypeCallProperty = (cpTimestamp, cpPartnerHandle, cpPartnerDispname,
                           cpConfId, cpJoinConference, cpConfParticipant,
                           cpConfParticipantsCount, cpType, cpStatus,
                           cpFailureReason, cpSubject, cpPSTNNumber, cpDuration,
                           cpSeen, cpDTMF, cpPSTNStatus);

const CALLPROPERTY_STR : array[cpTimestamp..cpPSTNStatus] of string =
                          ('TIMESTAMP','PARTNER_HANDLE','PARTNER_DISPNAME',
                           'CONF_ID','JOIN_CONFERENCE','CONF_PARTICIPANT',
                           'CONF_PARTICIPANTS_COUNT','TYPE','STATUS',
                           'FAILUREREASON','SUBJECT','PSTN_NUMBER','DURATION',
                           'SEEN','DTMF','PSTN_STATUS');

const READABLE_CALLPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                set of TSkypeCallProperty =
                           // Protocol 1
                          ([cpTimestamp, cpPartnerHandle, cpPartnerDispname,
                            cpConfId, cpType, cpStatus, cpFailureReason,
                            cpSubject, cpPSTNNumber, cpDuration, cpPSTNStatus],
                           // Protocol 2
                           [cpTimestamp, cpPartnerHandle, cpPartnerDispname,
                            cpConfId, cpType, cpStatus, cpFailureReason,
                            cpSubject, cpPSTNNumber, cpDuration, cpPSTNStatus],
                           // Protocol 3
                           [cpTimestamp, cpPartnerHandle, cpPartnerDispname,
                            cpConfId, cpType, cpStatus, cpFailureReason,
                            cpSubject, cpPSTNNumber, cpDuration, cpPSTNStatus],
                           // Protocol 4
                           [cpTimestamp, cpPartnerHandle, cpPartnerDispname,
                            cpConfId, cpConfParticipant,
                            cpConfParticipantsCount, cpType, cpStatus,
                            cpFailureReason, cpSubject, cpPSTNNumber,
                            cpDuration, cpPSTNStatus]);

const WRITEABLE_CALLPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                 set of TSkypeCallProperty =
                           // Protocol 1
                          ([cpStatus,cpSeen,cpDTMF],
                           // Protocol 2
                           [cpStatus,cpSeen,cpDTMF],
                           // Protocol 3
                           [cpStatus,cpSeen,cpDTMF],
                           // Protocol 4
                           [cpStatus,cpSeen,cpDTMF,cpJoinConference]);

//------------------------------------------------------------------------------
// Message Properties ----------------------------------------------------------

type TSkypeMessageProperty = (mpTimestamp, mpPartnerHandle, mpPartnerDispname,
                              mpConfId, mpType, mpStatus, mpSeen,
                              mpFailureReason, mpBody);

const MESSAGEPROPERTY_STR : array[mpTimestamp..mpBody] of string =
                             ('TIMESTAMP','PARTNER_HANDLE','PARTNER_DISPNAME',
                              'CONF_ID','TYPE','STATUS','SEEN',
                              'FAILUREREASON','BODY');

const READABLE_MESSAGEPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                   set of TSkypeMessageProperty =
                         // Protocol 1
                        ([mpTimestamp, mpPartnerHandle, mpPartnerDispname,
                          mpConfId, mpType, mpStatus, mpFailureReason, mpBody],
                         // Protocol 2
                         [mpTimestamp, mpPartnerHandle, mpPartnerDispname,
                          mpConfId, mpType, mpStatus, mpFailureReason, mpBody],
                         // Protocol 3
                         [],  // since every MsgID is a ChatMsgID you can't use
                              // GET MESSAGE in Protocol 3 in a meaningful way
                              // at the moment...
                         // Protocol 4
                         []); // since every MsgID is a ChatMsgID you can't use
                              // GET MESSAGE in Protocol 4 in a meaningful way
                              // at the moment...

const WRITEABLE_MESSAGEPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                    set of TSkypeMessageProperty =
                         // Protocol 1
                        ([mpSeen],
                         // Protocol 2
                         [mpSeen],
                         // Protocol 3
                         [],
                         // Protocol 4
                         []);

//------------------------------------------------------------------------------
// Chat Properties -------------------------------------------------------------

type TSkypeChatProperty = (chName, chTimestamp, chAdder, chStatus, chPosters,
                           chMembers, chTopic, chChatMessages, chActiveMembers,
                           chFriendlyname);

const CHATPROPERTY_STR : array[chName..chFriendlyname] of string =
                          ('NAME','TIMESTAMP','ADDER','STATUS','POSTERS',
                           'MEMBERS','TOPIC','CHATMESSAGES','ACTIVEMEMBERS',
                           'FRIENDLYNAME');

const READABLE_CHATPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                set of TSkypeChatProperty =
                         // Protocol 1
                        ([],
                         // Protocol 2
                         [],
                         // Protocol 3
                         [chName, chTimestamp, chAdder, chStatus, chPosters,
                          chMembers, chTopic, chActiveMembers, chFriendlyname],
                         // Protocol 4
                         [chName, chTimestamp, chAdder, chStatus, chPosters,
                          chMembers, chTopic, chChatMessages, chActiveMembers,
                          chFriendlyname]); // CHATMESSAGES doesn't work at the
                                            // moment (Skype 1.2 Beta)

const WRITEABLE_CHATPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                 set of TSkypeChatProperty =
                           // Protocol 1
                          ([],
                           // Protocol 2
                           [],
                           // Protocol 3
                           [],
                           // Protocol 4
                           []);

//------------------------------------------------------------------------------
// Chat Message Properties -----------------------------------------------------

type TSkypeChatMsgProperty = (cmChatname, cmTimestamp, cmFromHandle,
                              cmFromDispname, cmType, cmUsers, cmLeaveReason,
                              cmBody, cmStatus, cmSeen);

const CHATMSGPROPERTY_STR : array[cmChatname..cmSeen] of string =
                             ('CHATNAME','TIMESTAMP','FROM_HANDLE',
                              'FROM_DISPNAME','TYPE','USERS','LEAVEREASON',
                              'BODY','STATUS','SEEN');

const READABLE_CHATMSGPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                   set of TSkypeChatMsgProperty =
                             // Protocol 1
                            ([],
                             // Protocol 2
                             [],
                             // Protocol 3
                             [cmChatname, cmTimestamp, cmFromHandle,
                              cmFromDispname, cmType, cmUsers, cmLeaveReason,
                              cmBody, cmStatus],
                             // Protocol 4
                             [cmChatname, cmTimestamp, cmFromHandle,
                              cmFromDispname, cmType, cmUsers, cmLeaveReason,
                              cmBody, cmStatus]);

const WRITEABLE_CHATMSGPROPERTY : array[1..SUPPORTED_PROTOCOL] of
                                    set of TSkypeChatMsgProperty =
                             // Protocol 1
                            ([],
                             // Protocol 2
                             [],
                             // Protocol 3
                             [cmSeen],
                             // Protocol 4
                             [cmSeen]);

//------------------------------------------------------------------------------
// Skype Privileges ------------------------------------------------------------

type TSkypePrivilege = (spSkypeOut);

const PRIVILEGE_STR : array[spSkypeOut..spSkypeOut] of string =
                       ('SKYPEOUT');

const READABLE_PRIVILEGE : array[1..SUPPORTED_PROTOCOL] of
                             set of TSkypePrivilege =
                       // Protocol 1
                       ([spSkypeOut],
                       // Protocol 2
                        [spSkypeOut],
                       // Protocol 3
                        [spSkypeOut],
                       // Protocol 4
                        [spSkypeOut]);

const WRITEABLE_PRIVILEGE : array[1..SUPPORTED_PROTOCOL] of
                              set of TSkypePrivilege =
                       // Protocol 1
                       ([],
                       // Protocol 2
                        [],
                       // Protocol 3
                        [],
                       // Protocol 4
                        []);

//------------------------------------------------------------------------------
// Skype Profiles --------------------------------------------------------------

type TSkypeProfile = (spfPSTNBalance, spfRichMood, spfPSTNBalanceCurrency);

const PROFILE_STR : array[spfPSTNBalance..spfPSTNBalanceCurrency] of string =
                      ('PSTN_BALANCE','RICH_MOOD_TEXT','PSTN_BALANCE_CURRENCY');


const READABLE_PROFILE : array[1..SUPPORTED_PROTOCOL] of
                           set of TSkypeProfile =
                         // Protocol 1
                         ([],
                         // Protocol 2
                          [],
                         // Protocol 3
                          [],
                         // Protocol 4
                          [spfPSTNBalance, spfRichMood, spfPSTNBalanceCurrency]);
                          // this seem to work with earlier versions of Skype
                          // but i will not enable it until it's testet with
                          // "real" old version, not by just switching with the
                          // PROTOCOL command...

const WRITEABLE_PROFILE : array[1..SUPPORTED_PROTOCOL] of
                            set of TSkypeProfile =
                          // Protocol 1
                          ([],
                          // Protocol 2
                           [],
                          // Protocol 3
                           [],
                          // Protocol 4
                           []);

//------------------------------------------------------------------------------
// Event Types -----------------------------------------------------------------

type
  TSkypeErrorNotify = procedure(Code : integer; Description : string) of object;

  TSkypeUserStatusNotify = procedure(UserStatus : TSkypeUserStatus) of object;

  TSkypeConnStatusNotify = procedure(ConnStatus : TSkypeConnStatus) of object;

  TSkypeCurrentUserHandleNotify = procedure(UserHandle : string) of object;

  TSkypeSearchNotify = procedure(SearchType : TSkypeSearchType;
                                 aList : TStringList) of object;

  TSkypeUserNotify = procedure(Username : string;
                               UserProperty : TSkypeUserProperty;
                               data : string) of object;

  TSkypeNameNotify = procedure(Name : string) of object;

  TSkypeProtocolNotify = procedure(ProtocolNumber : integer) of object;

  TSkypeCallNotify = procedure(CallId : Integer;
                               CallProperty : TSkypeCallProperty;
                               data : string) of object;

  TSkypeMessageNotify = procedure(MessageID : Integer;
                                  MessageProperty : TSkypeMessageProperty;
                                  data : string) of object;

  TSkypeChatNotify = procedure(Chatname : string;
                               ChatProperty : TSkypeChatProperty;
                               data : string) of object;

  TSkypeChatMsgNotify = procedure(ChatMsgID : Integer;
                                  ChatMsgProperty : TSkypeChatMsgProperty;
                                  data : string) of object;

  TSkypeAudioNotify = procedure(Device : string) of object;

  TSkypeMuteNotify = procedure(Muted : boolean) of object;

  TSkypePrivilegeNotify = procedure(priv : TSkypePrivilege;
                                    granted : boolean) of object;

  TSkypeProfileNotify = procedure(priv : TSkypeProfile;
                                  data : string) of object;

  TSkypeVersionNotify = procedure(Version : string) of object;

  TNotSupportedErrorNotify = procedure(errormsg : string) of object;

  TSkypeCopyData = procedure(rawdata : string) of object;

implementation

end.
